package practice.w830;

public class OperDemo3 {
    public static void main(String[] args) {
        int a=5,b=10,c=5;
        //演示&&
        boolean b1 = b>=a && b<c;
        System.out.println(b1);          //true&&false=false
        System.out.println(b<=c && b>a); //false&&true=false
        System.out.println(a==b && c>b); //false&&false=false
        System.out.println(b!=c && a<b); //true&&true=true
        //演示||
        System.out.println(b>=a || b<c); //true||false=true
        System.out.println(b<=c || b>a); //false||true=true
        System.out.println(b!=c || a<b); //true||true=true
        System.out.println(a==b || c>b); //false||false=false
        //演示!
        boolean b2 = !(a<b);
        System.out.println(b2);     //!true=false
        System.out.println(!(a>b)); //!false=true

        //演示&&的短路
        int e=5,f=10,g=5;
        boolean b3 = e>f && g++>2;
        System.out.println(b3); //false
        System.out.println(g);  //5，发生短路了

        //演示||的短路
        boolean b4 = a<b || c++>2;
        System.out.println(b4); //true
        System.out.println(c);  //5，发生短路了


//        int a=5,b=10,c=5;
//        boolean b1 = b>=a && b<c;
//        System.out.println(b1);          //true&&false=false
//        System.out.println(b<=c && b>a); //false&&true=false
//        System.out.println(a==b && c>b); //false&&false=false
//        System.out.println(b!=c && a<b); //true&&true=true

//        System.out.println(b>=a || b<c); //true||false=true
//        System.out.println(b<=c || b>a); //false||true=true
//        System.out.println(b!=c || a<b); //true||true=true
//        System.out.println(a==b || c>b); //false||false=false

//        boolean b2 = !(a<b);
//        System.out.println(b2);     //!true=false
//        System.out.println(!(a>b)); //!false=true
//

//        int e=5,f=10,g=5;
//        boolean b3 = e>f && g++>2;
//        System.out.println(b3); //false
//        System.out.println(g);  //5，发生短路了
//

//        boolean b4 = a<b || c++>2;
//        System.out.println(b4); //true
//        System.out.println(c);  //5，发生短路了
    }
}
